package com.qidian.mes.quality.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.pojo.Detect;
import com.qidian.mes.pojo.Quality;
import com.qidian.mes.quality.service.DefectService;
import com.qidian.mes.quality.service.DetectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author gfdycxy
 * @Company cxy
 * @Description
 * @Time 2024/10/17 19:14
 */
@RestController
@CrossOrigin
@RequestMapping("/detect")
public class DetectController {
    @Autowired
    private DetectService detectService;

    @GetMapping("/detectList")
    public MESResult detectList() {
        return detectService.selectAllDetect();
    }

    @PostMapping("/insert")
    public MESResult insert(@RequestBody Detect detect) {
        return detectService.insert(detect);
    }

    @PutMapping("/update")
    public MESResult update(@RequestBody Detect detect) {
        return detectService.updateById(detect);
    }

    @GetMapping("/getDetectById")
    public MESResult getDetectById(Long detectId){
        return detectService.queryById(detectId);
    }
    @DeleteMapping("/deleteById")
    public MESResult deleteById(String detectId) {
        return detectService.deleteById(detectId);
    }
    @DeleteMapping("/deleteByIds")
    public MESResult deleteByIds(String[] detectId) {
        return detectService.deleteByIds(detectId);
    }
}